NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

1
1

Can anyone help me get the query for all buildings which are 1 km or more away from any other building in Overpass Turbo?

The search area here is limited. All I have at the moment is

area[admin_level=4][name=Zeeland];
node(area)[building];
out;

When I extend it to include also area buildings, I get a timeout one

area[admin_level=4][name=Zeeland]->.a;
(
node(area.a)[building];
area(area.a)[building];
);
out;

How to solve that and secondly, how to add the restriction that each other building node or building area is 1 km or more away?

asked 16 May '17, 23:27

pander's gravatar image

pander
26225
accept rate: 0%

edited 17 May '17, 11:41

SK53's gravatar image

SK53 ♦
28.1k48268433


I'll defer to the Overpass Pros but I think you are over-stretching what Overpass can do here.

If you say the search area is limited, import the area into a PostGIS database with osm2pgsql and then do this:

SELECT building.osm_id 
FROM planet_osm_polygon building
WHERE 
   building.building IS NOT NULL AND
   (SELECT COUNT(*) FROM planet_osm_polygon other WHERE
   other.building IS NOT NULL AND 
   other.osm_id <> building.osm_id AND
   ST_DWITHIN(other.way,building.way,1000) LIMIT 1) = 0;

This searches in a "1000 mercator units" radius, you might have to adapt it to your particular area. Also, you might want to exclude "building=no", too. If you want to look for nodes with building tags too, then my recommendation would be to first create temporary table with the polygon centroids for all buildings and mix in the points. Will run much faster too.

permanent link

answered 16 May '17, 23:55

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for your reply. The eventual results should not be that many and I have seen similar examples in Overpass. (I will try to find them and post them here.) Setting up a PostGIS and importing is not favorable as I would like others to to the same query and tweak it. And I need otherwise set up a complete system with updates and security etc. In what way is this over-stretching Overpass?

(17 May '17, 09:19) pander

Zeeland is a large area containing thousands of buildings whereas the "highway around schools" query is limited to rather small areas around schools. I don't think these two queries are comparable.

(17 May '17, 10:22) scai ♦

Simple query on a map that has three buildings results in 30 MB data and abort of query from my side.

[out:json][timeout:25]; ( area"building"="house"; ); out body;

; out skel qt;

Is there something wrong with Overpass? I did lots of tests today and for very small areas, it (I guess) tries to query the entire world. Also for

[out:json][timeout:25]; area[admin_level=10][name=Ottoland]->.a; ( area(area.a)[building="house"]; ); out;

(17 May '17, 15:01) pander

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228
×85

question asked: 16 May '17, 23:27

question was seen: 4,261 times

last updated: 17 May '17, 15:02

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum